﻿ <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MemberPromotionDefault.aspx.cs" Inherits="bianzhuo.SupportPlatform.BzBusiness.MemberPromotionDefault" %>

<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>会员促销活动</title>
    <link href="css/style.css" rel="stylesheet" type="text/css" />
    <link href="css/input_ck.css" rel="stylesheet" type="text/css" />
    <link href="css/msg_css.css" rel="stylesheet" type="text/css" />
    <script src="js/jquery-1.7.2.min.js" type="text/javascript"></script>
    <script src="js/common.js" type="text/javascript"></script>
    <script src="js/tdcolor.js" type="text/javascript"></script>

</head>
<body>
    <form id="form1" runat="server">
        <div class="content">
            <ul class="breadcrumb">
                <li>
                    <div class="tem_img tem_l" title="关闭左侧菜单" id="closeleftframe" onclick="parent.document.getElementsByTagName('frameset')[1].cols = '0,*'; $('#closeleftframe').hide(); $('#openleftframe').show();"></div>
                    <div class="tem_img tem_r" title="展开左侧菜单" id="openleftframe" onclick="parent.document.getElementsByTagName('frameset')[1].cols = '240,*';$('#closeleftframe').show();$('#openleftframe').hide();"></div>
                </li>
                <li><a href="#">首页</a> <span class="divider">/</span></li>
                <li class="active">会员促销活动</li>
            </ul>
            <div class="container">
                <div class="member_div">
                    <ul>
                        <li>
                            <div class="mem_dbg mem_dbg01 mem_dtmd"></div>
                            <div class="mem_dtit"><a class="mem_dta" href="UserCardModify.aspx?MicroId=<%=MicroId%>">会员卡设置</a></div>
                        </li>
                        <li>
                            <div class="mem_dbg mem_dbg02 mem_dtmd"></div>
                            <div class="mem_dtit"><a class="mem_dta" href="MemberClassDefault.aspx?MicroId=<%=MicroId%>">会员卡等级</a></div>
                        </li>
                        <li>
                            <div class="mem_dbg mem_dbg03  mem_dtmd"></div>
                            <div class="mem_dtit"><a class="mem_dta" href="MemberPackageDefault.aspx?MicroId=<%=MicroId%>">会员卡套餐</a></div>
                        </li>
                        <li>
                            <div class="mem_dbg mem_dbg04"></div>
                            <div class="mem_dtit"><a class="mem_dth" href="MemberPromotionDefault.aspx?MicroId=<%=MicroId%>">会员促销活动</a></div>
                        </li>
                        <li>
                            <div class="mem_dbg mem_dbg05 mem_dtmd"></div>
                            <div class="mem_dtit"><a class="mem_dta" href="UserInfoDefault.Aspx?MicroId=<%=MicroId%>">会员管理</a></div>
                        </li>

                        <li>
                            <div class="mem_dbg mem_dbg06 mem_dtmd"></div>
                            <div class="mem_dtit"><a class="mem_dta" href="PointProManager/PointProductTypeManager.aspx">积分商城</a></div>
                        </li>


                    </ul>
                </div>
                <div>
                    <asp:Repeater ID="Repeater1" runat="server">
                        <HeaderTemplate>
                            <table class="user_list" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                    <th width="18%" class="border_left">促销活动名称</th>
                                    <th width="22%" align="center">活动有效期</th>
                                    <th width="18%" align="center">活动内容</th>
                                    <th width="9%" align="center">参与方式</th>
                                    <th width="8%" align="center">数量</th>
                                    <th width="6%" align="center">领取</th>
                                    <th width="8%" align="center">活动状态</th>
                                    <th width="13%" align="center">操作</th>
                                </tr>
                        </HeaderTemplate>
                        <ItemTemplate>
                            <tr class="td25">
                                <td height="30" align="center" class="border_left"><span class="promUrl" data-type="<%#Eval("proType")%>" data-id="<%#Eval("proId")%>" data-shop="<%#GetPromShopName(Eval("proId")) %>" style="cursor: pointer"><%#Eval("proName")%><span class="mem_zhek4">[<%#getPromotionType(Eval("proType"))%>]</span></span></td>
                                <td height="30" align="center"><span class="mem_zhek3"><%#Convert.ToDateTime(Eval("proStartTime")).ToString("yyyy-M-d H:mm")%></span>&nbsp;到&nbsp;<span class="mem_zhek3"><%#(Eval("proEndTime")==null)?"不限":Convert.ToDateTime(Eval("proEndTime")).ToString("yyyy-M-d H:mm")%></span></td>
                                <td align="center"><%#getPromotionContent(Eval("proId"))%></td>
                                <td align="center"><%#getProParticipation(Eval("proId"))%></td>
                                <td align="center"><%#getPromitionNumber(Eval("proId"))%></td>
                                <td align="center"><span class="mem_zhek2"><%#getMemberSumOfUserPromotion(Eval("proId"),0)%></span></td>
                                <td align="center"><a href="javascript:;" class="btn_small btnstatus <%#getStatusClass(Eval("proId"))%>" data-url="?MicroId=<%=MicroId%>&status=<%#Eval("proId")%>"><%#getStatus(Eval("proId"))%></a></td>
                                <td height="30" align="center">
                                    <a <%#Eval("proType").ToString()=="7"?"style=\"display:none;\"":"" %> href="MemberPromotionModify.aspx?MicroId=<%=MicroId%>&id=<%#Eval("proId")%>" class="btn_small">编辑</a>
                                    
                                    <a <%#Eval("proType").ToString()=="7"?"":"style=\"display:none;\"" %>  href="Member/MemberPromotionWxSQ.aspx?MicroId=<%=MicroId%>&proID=<%#Eval("proId")%>&type=formE" class="btn_small">编辑</a>
                                    
                                    
                                    <a href="javascript:;" data-url="?MicroId=<%=MicroId%>&delete=<%#Eval("proId")%>" class="btn_small btndelete">删除</a></td>
                            </tr>
                        </ItemTemplate>
                        <FooterTemplate>
                            <tr>
                                <td colspan="8" class="border_left"><a href="MemberPromotionModify.aspx?MicroId=<%=MicroId%>" class="btn_small btn-01">添加会员促销活动</a></td>
                            </tr>
                            </table>
                        </FooterTemplate>

                    </asp:Repeater>
                    <div class="pagination">
                        <webdiyer:AspNetPager ID="AspNetPager1" runat="server" FirstPageText="首页"
                            LastPageText="尾页" NextPageText="下一页" OnPageChanged="AspNetPager1_PageChanged"
                            PrevPageText="上一页" PagingButtonSpacing="0px" UrlPaging="True" NumericButtonCount="3" PageIndexBoxType="TextBox" ShowPageIndexBox="Never" SubmitButtonText="Go" TextAfterPageIndexBox="页" TextBeforePageIndexBox="转到" AlwaysShow="True" EnableTheming="True" ShowMoreButtons="False">
                        </webdiyer:AspNetPager>
                    </div>
                </div>
            </div>
        </div>
    </form>
    <div class="seehd_mdiv">
        <div class="seehd_mdiv_tit">促销活动预览地址<span></span></div>
        <div class="see_cdmx">
            <ul>
                <li></li>
            </ul>
        </div>
    </div>
    <script>
        $('.btndelete').click(function () {
            if (confirm('将删除用户已领取的活动')) {
                $.get($(this).attr('data-url'), function (data) {
                    msg = "";
                    if (data == "1") {
                        msg = "删除成功";
                    }
                    else {
                        msg = "删除失败";
                    }
                    alert(msg);
                    location.reload();
                });
            }
        })

        $('.btnstatus').click(function () {
            $.get($(this).attr('data-url'), function (data) {
                msg = "";
                if (data == "1") {
                    msg = "促销启动成功";
                }
                else if (data == "0") {
                    msg = "促销启动失败";
                } else {
                    msg = data;
                }
                if (msg != "") alert(msg);
                location.reload();
            });

        });

        //弹出活动地址
        $(".seehd_mdiv_tit span").click(function () {
            makeHuixianceng();
            $(".seehd_mdiv").hide();
        });

        //居中显示 
        $(window).scroll(function () {
            $(".seehd_mdiv").center();
        })

        $('.promUrl').click(function () {
            var type = $(this).attr('data-type');
            var proid = $(this).attr('data-id');
            var shopname = $(this).attr('data-shop');
            switch (type) {
                case '1':
                    mobUrl = 'http://wx.ajiuqian.com/PlugIn/Promotion/Discount/DiscountInfo.aspx?PromotionId=' + proid + '&wxID=<%=MicroId%>';
                    $('.see_cdmx li').html("手机访问地址：<br/><a href='" + mobUrl + "' target=_blank>" + mobUrl + "</a>");
                    break;
                case '2':
                    mobUrl = 'http://wx.ajiuqian.com/PlugIn/Promotion/Coupons/CouponsInfo.Aspx?PromotionId=' + proid + '&wxID=<%=MicroId%>';
                    $('.see_cdmx li').html("手机访问地址：<br/><a href='" + mobUrl + "' target=_blank>" + mobUrl + "</a>");
                    break;
                case '3':
                    mobUrl = 'http://wx.ajiuqian.com/PlugIn/Promotion/FreeGive/FreeGiveInfo.Aspx?PromotionId=' + proid + '&wxID=<%=MicroId%>';
                    $('.see_cdmx li').html("手机访问地址：<br/><a href='" + mobUrl + "' target=_blank>" + mobUrl + "</a>");
                    break;
                case '4':
                    mobUrl = 'http://wx.ajiuqian.com/PlugIn/Promotion/Seckill/Index.Aspx?PromotionId=' + proid + '&wxID=<%=MicroId%>';
                    $('.see_cdmx li').html("手机访问地址：<br/><a href='" + mobUrl + "' target=_blank>" + mobUrl + "</a>");
                    break;
                case '5':
                    mobUrl = 'http://wx.ajiuqian.com/PlugIn/Promotion/Eggs/index.aspx?PromotionId=' + proid + '&wxID=<%=MicroId%>';
                    $('.see_cdmx li').html("手机访问地址：<br/><a href='" + mobUrl + "' target=_blank>" + mobUrl + "</a>");
                    break;
                case '6':
                    webUrl = 'http://wx.ajiuqian.com/PlugIn/Promotion/adpowder/index.aspx?PromotionId=' + proid + '&wxID=<%=MicroId%>';
                    mobUrl = 'http://wx.ajiuqian.com/PlugIn/Promotion/adpowder/mobile.aspx?PromotionId=' + proid + '&wxID=<%=MicroId%>';
                    $('.see_cdmx li').html("电脑访问地址：<br/><a href='" + webUrl + "' target=_blank>" + webUrl + "</a><br/>" + "手机访问地址：<br/><a href='" + mobUrl + "' target=_blank>" + mobUrl + "</a>");
                    break;
                case '7':
                    mobUrl = 'http://wx.ajiuqian.com/PlugIn/wxWall/index.aspx?proID=' + proid + '&wxID=<%=MicroId%>';
                    $('.see_cdmx li').html("手机访问地址：<br/><a href='" + mobUrl + "' target=_blank>" + mobUrl + "</a>");
                    break;
                case '8':
                    mobUrl = 'http://wx.ajiuqian.com/PlugIn/Promotion/sudoku/index.aspx?PromotionId=' + proid + '&wxID=<%=MicroId%>';
                    $('.see_cdmx li').html("手机访问地址：<br/><a href='" + mobUrl + "' target=_blank>" + mobUrl + "</a>");
                    break;
            }
            if (shopname.length > 0) {
                $('.see_cdmx li').html($('.see_cdmx li').html() + '<br/>适用门店：'+shopname);
            }
            makeHuixianceng();
            $(".seehd_mdiv").show();
        });
    </script>
</body>
</html>
